package com.xjoyt.pay.merchant.register.po;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xjoyt.pay.constants.DateConstant;

/**
 * 商户
 * 
 * @author Administrator
 *
 */
@Entity
@Table(name = "t_merchant")
public class Merchant {

	/**
	 * 商户id
	 */
	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid2")
	@Column(name = "merchant_id", length = 50)
	public String id;

	/**
	 * 状态(null:未审核,true:审核通过,false:审核不通过)
	 */
	@org.hibernate.annotations.Type(type = "yes_no")
	@Column(name = "is_enabled")
	public Boolean enabled;

	/**
	 * 类型(true:企业,false 个人)
	 */
	@org.hibernate.annotations.Type(type = "yes_no")
	@Column(name = "type", length = 20)
	public Boolean type;

	/**
	 * 第三方商户号
	 */
	@NotNull
	@Column(name = "out_no", length = 50)
	public String outNo;

	/**
	 * 	
	 */
	@NotNull
	@Column(name = "`name`", length = 50)
	public String name;

	/**
	 * 店名
	 */
	@Column(name = "shop_name", length = 255)
	public String shopName;

	/**
	 * 法人姓名
	 */
	@Column(name = "legal_person", length = 50)
	public String legalPerson;

	/**
	 * 法人身份证号
	 */
	@Column(name = "legal_person_id_number", length = 50)
	public String legalPersonIdNumber;

	/**
	 * 联系电话
	 */
	@NotNull
	@Column(name = "phone", length = 50)
	public String phone;

	/**
	 * 客服电话
	 */
	@Column(name = "telephone", length = 50)
	public String telephone;

	/**
	 * 邮箱
	 */
	@Column(name = "email", length = 50)
	public String email;

	/**
	 * 身份证,营业执照号
	 */
	@Column(name = "id_number", length = 50)
	public String idNumber;

	/**
	 * 地址
	 */
	@Column(name = "address", length = 255)
	public String address;

	/**
	 * 入住日期
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "added_date")
	@JsonFormat(pattern = DateConstant.DATE_TIME_FORMAT_PATTERN, timezone = "GMT+8")
	public Date addedDate;

	/**
	 * 代理商
	 */
	@ManyToOne(targetEntity = Distributor.class, cascade = {})
	@JoinColumn(name = "distributor_id", foreignKey = @ForeignKey(name = "none"))
	// @JsonIgnore
	public Distributor distributor;

	/**
	 * 联行号
	 */
	@Column(name = "bank_code", length = 50)
	public String bankCode;

	/**
	 * 开户行名称
	 */
	@Column(name = "bank", length = 50)
	public String bank;

	/**
	 * 账号类型(true:对私账号,false:对公账号)
	 */
	@org.hibernate.annotations.Type(type = "yes_no")
	@Column(name = "is_personal")
	public Boolean personal;

	/**
	 * 开户户名
	 */
	@Column(name = "card_name", length = 50)
	public String cardName;

	/**
	 * 开户卡号
	 */
	@Column(name = "card_no", length = 50)
	public String cardNo;

	/**
	 * 开户人手机号
	 */
	@Column(name = "card_phone", length = 50)
	public String cardPhone;

	/**
	 * 开户人身份证号
	 */
	@Column(name = "card_id_number", length = 50)
	public String cardIdNumber;

	/**
	 * 银行所在省
	 */
	@Column(name = "bank_province", length = 50)
	public String bankProvince;

	/**
	 * 银行所在时
	 */
	@Column(name = "bank_city", length = 50)
	public String bankCity;

	/**
	 * 开户行地址
	 */
	@Column(name = "bank_address", length = 50)
	public String bankAddress;

	/**
	 * 身份证正面照片
	 */
	@Column(name = "identity_card_front_image_url", length = 255)
	public String identityCardFrontImageUrl;

	/**
	 * 身份证背面照片
	 */
	@Column(name = "identity_card_back_image_url", length = 255)
	public String identityCardBackImageUrl;

	/**
	 * 手持身份证照片
	 */
	@Column(name = "identity_card_image_url", length = 255)
	public String identityCardImageUrl;

	/**
	 * 银行卡照片
	 */
	@Column(name = "bank_card_image_url", length = 255)
	public String bankCardImageUrl;

	/**
	 * 开户许可证照片
	 */
	@Column(name = "account_licence_image_url", length = 255)
	public String accountLicenseImageUrl;

	/**
	 * 门面照片
	 */
	@Column(name = "facade_image_url", length = 255)
	public String facadeImageUrl;

	/**
	 * 营业执照照片
	 */
	@Column(name = "license_image_url", length = 255)
	public String licenseImageUrl;
}
